<%@page import="com.ignou.mca.beans.ExamBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.ignou.mca.datasource.DatabaseOperations"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.ignou.mca.beans.UserVO"%><html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="theme/style.css"
	media="screen" />
<title>OES - Delete Exam</title>
<script type="text/javascript">
	function deleteExamConfirm(examId)
	{
		var altTxt = "You are trying to delete "+examId+" exam.\n Click 'OK' to continue to delete. \n Click 'Cancel' to cancel the submission. '";
		if (confirm(altTxt))
		{
			window.location.href = 'DeleteExam.jsp?exam='+examId; 
		}
		else
		{
		}
	}

</script>
</head>
<body>
	<div id="MainWrapper">
		<jsp:include page="header.jsp" /> 
		<jsp:include page="LeftContainer.jsp" />
		<div id="MainContent">
			<center><h2>Delete Exam</h2></center>
		<%
			UserVO uvo = (UserVO) session.getAttribute("UserVO");
			if(uvo==null)
			{
				response.sendRedirect("./Login.jsp");
			}
			else
			{
				int subjectID = 0;
				String ex = request.getParameter("exam");
				int examId = Integer.parseInt(ex);
				DatabaseOperations dbOperations = new DatabaseOperations();
				Boolean isDeleted = dbOperations.deleteExam(examId);
				if(isDeleted)
				{
					response.sendRedirect("./Subjects.jsp");
				}else
				{
					out.println("<center><font color='red'><b>Unable to delete.</b></font></center>");
				}
			}	
			%>
		</div>
		<jsp:include page="footer.jsp" />
	</div>
</body>
</html>